#pragma once

// #ifdef GFXFILTER

#define AMIGA_WIDTH_MAX (752 / 2)
#define AMIGA_HEIGHT_MAX (574 / 2)

// typedef unsigned char u8;
// typedef unsigned short u16;
// typedef uint u32;

// extern void S2X_refresh();
extern void S2X_render();
extern void S2X_init(int dw, int dh, int aw, int ah, int ad, int dd);
extern void S2X_free();
extern int S2X_getmult();

// extern void PAL_init();
// extern void PAL_1x1_32(uint* src, int pitchs, uint* trg, int pitcht, int width, int height);
// extern void PAL_1x1_16(ushort* src, int pitchs, ushort* trg, int pitcht, int width, int height);

// typedef unsigned char uint8;
// typedef unsigned short uint16;
// typedef uint uint32;
//     #ifndef __cplusplus
// typedef int bool;
//     #endif

// extern "C"
// {
extern void S2X_configure(int rb, int gb, int bb, int rs, int gs, int bs);
extern int Init_2xSaI(int rb, int gb, int bb, int rs, int gs, int bs);

void Super2xSaI_16(const byte* srcPtr, uint srcPitch, byte* dstPtr, uint dstPitch, int width, int height);
void Super2xSaI_32(const byte* srcPtr, uint srcPitch, byte* dstPtr, uint dstPitch, int width, int height);
void SuperEagle_16(const byte* srcPtr, uint srcPitch, byte* dstPtr, uint dstPitch, int width, int height);
void SuperEagle_32(const byte* srcPtr, uint srcPitch, byte* dstPtr, uint dstPitch, int width, int height);
void _2xSaI_16(const byte* srcPtr, uint srcPitch, byte* dstPtr, uint dstPitch, int width, int height);
void _2xSaI_32(const byte* srcPtr, uint srcPitch, byte* dstPtr, uint dstPitch, int width, int height);
void AdMame2x(byte* srcPtr, uint srcPitch,  /* byte deltaPtr, */
    byte* dstPtr, uint dstPitch, int width, int height);
void AdMame2x32(byte* srcPtr, uint srcPitch,  /* byte deltaPtr, */
    byte* dstPtr, uint dstPitch, int width, int height);

extern void hq_init(int rb, int gb, int bb, int rs, int gs, int bs);
// extern void _cdecl hq2x_16(unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
// extern void _cdecl hq2x_32(unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
// extern void _cdecl hq3x_16(unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
// extern void _cdecl hq3x_32(unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
// extern void _cdecl hq4x_16(unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
// extern void _cdecl hq4x_32(unsigned char*, unsigned char*, DWORD, DWORD, DWORD);
// }

#define UAE_FILTER_NULL 1
#define UAE_FILTER_SCALE2X 2
// #define UAE_FILTER_HQ2X 3
// #define UAE_FILTER_HQ3X 4
// #define UAE_FILTER_HQ4X 5
#define UAE_FILTER_SUPEREAGLE 3
#define UAE_FILTER_SUPER2XSAI 4
#define UAE_FILTER_2XSAI 5
// #define UAE_FILTER_PAL 9
#define UAE_FILTER_LAST 5

#define UAE_FILTER_MODE_16 16
#define UAE_FILTER_MODE_16_16 16
#define UAE_FILTER_MODE_16_32 (16 | 8)
#define UAE_FILTER_MODE_32 32
#define UAE_FILTER_MODE_32_32 32
#define UAE_FILTER_MODE_32_16 (32 | 8)

struct uae_filter
{
    int type, /*yuv,*/ intmul;
    TCHAR* name, * cfgname;
    int flags;
};

extern struct uae_filter uaefilters[];
extern struct uae_filter* usedfilter;

void getfilterrect2(RECT* sr, RECT* dr, RECT* zr, int dst_width, int dst_height, int aw, int ah, int scale, int temp_width, int temp_height);
void getfilteroffset(int* dx, int* dy, int* mx, int* my);
byte* getfilterbuffer(int* widthp, int* heightp, int* pitch, int* depth);
// byte * getfilterbuffer3d(int* widthp, int* heightp, int* pitch, int* depth);

extern void getrtgfilterrect2(RECT* sr, RECT* dr, RECT* zr, int dst_width, int dst_height);

// #endif